package datatypes.r2.foundation.impl;

import javax.persistence.Column;
import javax.persistence.Entity;

import datatypes.r2.basic.ST;
import datatypes.r2.basic.impl.CharacterString;
import datatypes.r2.foundation.BL;
import datatypes.r2.foundation.TYPE;

/**
 * The data type of a data element or property.
 * 
 * @author Obama
 * 
 */
public class DataType extends DataValue implements TYPE {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * The alias of the data type.
	 */
	@Column
	private CharacterString shortName;
	/**
	 * The full name of the data type.
	 */
	@Column
	private CharacterString longName;

	/**
	 * Two nonNull data types are equal if they are the same type.
	 * 
	 * @param x
	 * @return
	 */
	public Boolean equal(DataType x) {
		return new Boolean(this.equals(x));
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null || shortName == null) {
			return false;
		} else if (!(obj instanceof DataType)) {
			return false;
		} else {
			DataType dataType = (DataType) obj;
			return shortName.equals(dataType);
		}

	}

	/**
	 * The alias of the data type.
	 */
	@Override
	public ST shortName() {

		return shortName;
	}

	/**
	 * The full name of the data type.
	 */
	@Override
	public ST longName() {

		return longName;
	}

	/**
	 * A relation that indicates that a data type has the same type or is a
	 * specialization of the argument type.
	 */
	@Override
	public BL implies(TYPE that) {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * A relation that indicates whether two types have the same equality
	 * criteria
	 */
	@Override
	public BL isComparableTo(TYPE that) {
		// TODO Auto-generated method stub
		return null;
	}

}
